'''
import os
from core.std import Editor
from core.graph import Pipeline
from core import cmds
from core.base import ComponentSelected, Plugin, ComponentBase, ComponentMeta, Component


from ui.delegates import AttrDelegate
from ui.widgets import QCellWidget, QContainerViewWidget, QMenuWidget, ImageWidget, DataEditorWidget
from ui.pyeditor import PythonScriptEditor, PluginEditorWidget
from ui.graph import GraphView
from ui.plotting import PlotGraphWidget

from PyQt4.QtCore import SIGNAL, QObject
from PyQt4.QtGui import QWidget, QCursor, QLabel, QPixmap, QHeaderView




        
    
class DataView(object):
    _dataviews = {}
    
    datatype = None
    widget = QLabel

    def setup(self): pass

    def __init__(self, data, *args, **kw):
        View.__init__(self, *args, **kw)
        self.widget = self.__class__.widget(None)
        self.data = data
        self.data.change.connect(self.data_change)
        self.delegate = DataDelegate(self)
        self._dataviews[self.datatype] = self
        
    def get(self, datatype):
        return self._dataviews.get(datatype)
        


class ImageView(DataView):
    datatype = ni.Image
    widget = ImageWidget
    
    def data_change(self):
        data = self.data.get()
        #print data, os.path.exists(data)
        if os.path.exists(data):
            self.widget.load(data)
        self.delegate.update()



            

class ContainerView(ni.View):
    widget = QContainerViewWidget
    view = ni.Reference(type=ni.View)
    set_view_on = ni.Slot(method="set_view")
    
    def set_view(self, view):
        if not isinstance(view, ni.View): 
            return
        if view is self: 
            return
        
        if hasattr(self, '_view_widget'):
            self.view.rem_widget(self._view_widget)
        self.view = view
        if self.view is None: 
            return
        view_widget = self.view.new_widget()
        for widget in self.widgets:
            widget.add_widget(view_widget)
        self._view_widget = view_widget
        self.view.update_widget(view_widget)
        
class Menu(ni.View):
    data = ni.Tree(item_type=ni.Function(args=("parent",)))
    checkable = ni.Bool(default=False)
    checked = ni.Function(args=("item",))
    #checked_items = List(None)
    
    widget = QMenuWidget
    
    def update_widget(self, widget):
        widget._model.data = self.data
        widget.checkable = self.checkable
        widget.checked = self.checked
        widget.create_menu()
        widget.setTitle(self.name)
        widget.connect(widget, SIGNAL("aboutToShow()"), lambda w=widget: self.update_menu(w))
        widget.connect(widget, SIGNAL("itemToggled"), self.on_item_toggled)
        
    def update_menu(self, menu):
        menu.create_menu()
        
    def on_item_toggled(self, item, cheked):
        pass
        
'''


    

        
        

        
        
        
    